package com.注解;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class 注解 {
    public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, InvocationTargetException {
         Class<?> aClass = Class.forName("com.注解.UserTest");
        UserTest newInstance = (UserTest)aClass.newInstance();
        Method[] declaredMethods = aClass.getDeclaredMethods();
        for (Method declaredMethod : declaredMethods) {
            if(declaredMethod.isAnnotationPresent(Test.class)){
                declaredMethod.invoke(newInstance);
            }
        }

    }
}
